/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package AccountDTO;

import RoomDTO.Room;
import java.util.*;

/**
 *
 * @author Phuong Giang
 */
public class AccountExtended extends Account {
    List<Room> roomList;

    public AccountExtended(Account acc) {
        super.displayName = acc.displayName;
        super.username = acc.username;
        super.password = acc.password;
        this.roomList = new ArrayList<Room>();
    }

    public AccountExtended(List<Room> roomList) {
        this.roomList = roomList;
    }

    public List<Room> getRoomList() {
        return roomList;
    }

    public void setRoomList(List<Room> roomList) {
        this.roomList = roomList;
    }


    public boolean removeRoom(String id) {
        for (Room r : roomList) {
            if (r.getRoomID().equals(id)) {
                roomList.remove(r);
                return true;
            }
        }
        return false;
    }

    public boolean addRoom(Room room) {
        if (!roomList.contains(room)) {
            roomList.add(room);
            return true;
        }
        return false;
    }
}
